package dto

import (
	"tuowei.com/app/admin/models"
	"tuowei.com/common/dto"
	common "tuowei.com/common/models"
)

type SysCourseGiftInsertReq struct {
	Id       int    `json:"id" comment:"主键ID"`
	CourseId int    `json:"course_id" comment:"课程ID"`
	GiftType string `json:"gift_type" comment:"赠送类型"`
	ObjIds   string `json:"obj_ids" comment:"对象IDs"`
}

func (s *SysCourseGiftInsertReq) Generate(model *models.SysCourseGift) {
	//model.CourseId = s.CourseId
	model.CourseId = s.CourseId
	model.GiftType = s.GiftType
	model.ObjIds = s.ObjIds

}

func (s *SysCourseGiftInsertReq) GetId() interface{} {
	return s.Id
}

type SysCourseGiftGetPageReq struct {
	dto.Pagination `search:"-"`
	Name           string `form:"name" search:"type:exact;column:name;table:sys_class" comment:"班级名称"`
	HeadMaster     string `form:"head_master" search:"type:exact;column:head_master;table:sys_class" comment:"班主任"`
	ClassType      string `form:"class_type" search:"type:exact;column:class_type;table:sys_class" comment:"班级分类"`
	DeptJoin       `search:"type:left;on:dept_id:dept_id;table:sys_class;join:sys_dept"`
}

func (m *SysCourseGiftGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type SysCourseGiftUpdateReq struct {
	Id       int    `json:"id" comment:"主键ID" vd:"$>0;msg:'更新ID不能为空'"`
	CourseId int    `json:"course_id" comment:"课程ID"`
	GiftType string `json:"gift_type" comment:"赠送类型"`
	ObjIds   string `json:"obj_ids" comment:"对象ID"`
}

func (s *SysCourseGiftUpdateReq) Generate(model *models.SysCourseGift) {
	if s.Id != 0 {
		model.Id = s.Id
	}

	model.CourseId = s.CourseId
	model.GiftType = s.GiftType
	model.ObjIds = s.ObjIds
}

func (s *SysCourseGiftUpdateReq) GetId() interface{} {
	return s.Id
}

type SysCourseGiftById struct {
	dto.ObjectById
	common.ControlBy
}

type SysCourseGiftSearchReq struct {
	ClassType string `form:"class_type" search:"type:exact;column:class_type;table:sys_class" comment:"班级类型"`
	Name      string `form:"name" search:"type:contains;column:name;table:sys_class" comment:"根据班级名称搜索关键字"`
}

func (m *SysCourseGiftSearchReq) GetNeedSearch() interface{} {
	return *m
}

type SysCourseGiftGetReq struct {
	CourseId int `uri:"course_id"`
}

func (s *SysCourseGiftGetReq) GetId() interface{} {
	return s.CourseId
}
